#include <stdio.h>

extern double power(double x,int n);

extern unsigned int factorial(int x);

extern double modul(double x);

int main(){

	double x;
	int factx,n;
	char f;

	printf("Enter operation <'^','!','a'>\n");
	scanf("%c",&f);
	switch (f){
		case '^':
			printf("Enter arguments\n");
			scanf("%lf%d",&x,&n);
			if ((x==0 && n==0)||(n<0)){
				printf("Invalid arguments\n");
				return 0;
			}
			else{
				printf("f(x)=%lf\n",power(x,n));
				return 0;
			}
		case '!': 
			printf("Enter argument\n");
			scanf("%d",&factx);
			if (factx<0){
				printf("Invalid argument\n");
				return 0;
			}
			else{
				printf("f(x)=%u\n",factorial(factx));
				return 0;
			}
		case 'a':
			printf("Enter argument\n");
			scanf("%lf",&x);
			printf("f(x)=%lf\n",modul(x));
			return 0;
		default:
			printf("Invalid operation\n");
			return 0;
	}
}
